main() {
  // dynamic 动态类型 什么类型都可以 就是any
  List goodsList = [
    {"id": 1, "price": 22.68, "count": 10, "goods_name": "西瓜", "selectd": true},
    {"id": 2, "price": 11.99, "count": 10, "goods_name": "草莓", "selectd": true},
    {
      "id": 3,
      "price": 60.99,
      "count": 10,
      "goods_name": "车厘子",
      "selectd": false
    },
    {
      "id": 4,
      "price": 11.68,
      "count": 10,
      "goods_name": "平谷大桃",
      "selectd": false
    }
  ];
  //1.计算选中商品的总金额
  double totalPrice = 0;
  for (int i = 0; i < goodsList.length; i++) {
    if (goodsList[i]['selectd'] == true) {
      print(goodsList[i]['price']);
      totalPrice += goodsList[i]['price'] * goodsList[i]['count'];
      print(totalPrice);
    }
  }
  //2.打印选中商品的总金额
  print('选中的商品总能金额为${totalPrice.toStringAsFixed(2)}');

}
